<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="app"></div>
    <script>
        show()
        setInterval(show,1000)
        function show(){
            var app = document.querySelector(".app")
            console.log(app)
            var time = "2021-10-16 00:00:00"
            var nowTime = +new Date();
            var endTime = +new Date(time);
            
            var gapTime = (endTime-nowTime)/1000;
            console.log(gapTime)
            var d = Math.floor(gapTime/60/60/24)
            
            var h = Math.floor(gapTime/60/60%24)
            console.log(h)
            var m = Math.floor(gapTime/60%60)
            var s = Math.floor(gapTime%60)
            var sum = handleNum(d)+":"+handleNum(h)+":"+handleNum(m)+":"+handleNum(s)
            app.innerHTML = sum;
        }
        function handleNum(num){
            if(num<10){
                num = "0"+num;
                
            }
            return num ;
        }
    </script>
</body>
</html>